var loginSign='';
var urlPage="";
var interval="";
window.onload = function() {
	var url = document.location.toString();               
　　  if(url.indexOf("/") != -1){  
        url = url.substring(url.lastIndexOf("/")+1,url.lastIndexOf(".")) ; 
        urlPage=url;
        console.log(url);
　　　}
	slf.getSequenceChild();
    initDate()
};
/*******************************/
var currDT;
var aryDay = new Array("日", "一", "二", "三", "四", "五", "六"); //显示星期
var lastDay; //页面显示的最后一天
var firstDay; //页面显示的第一天
var date = new Date; //获取完整日期
var year = date.getFullYear(); //获取当前年份
//    alert(year);
//上课预约
function recordClass(){
	if(slf.checkSign()){
		//已登录
		slf.getSequenceChild();
		if(slf.schoolId=='a'||slf.schoolId==undefined||slf.schoolId==''){
			var messPrompt="请先完善孩子信息，是否现在去完善？"
			$("#class_model .am-modal-bd").html(messPrompt)
			$("#class_model").modal({
				closeViaDimmer: false,
				onConfirm: function(options) {
					window.location.href = "personal/child_list.html"
		        },
			});
		}else{
			window.location.href = "class_record.html"
		}
	}else{
		//未登录
		var messPrompt="此功能仅对登录用户开放，是否需要登录？"
		$(".operationModalBody").html(messPrompt)
		$("#operationModal").modal({
			closeViaDimmer: false,
			onConfirm: function(options) {
				window.location.href = "login.html"
	        },
	        onCancel: function() {
	          
	        }
		})
	}
}
//剩余课时
function timeClass(){
	if(slf.checkSign()){
		//已登录
		slf.getSequenceChild();
		if(slf.schoolId=='a'||slf.schoolId==undefined||slf.schoolId==''){
			var messPrompt="请先完善孩子信息，是否现在去完善？"
			$("#class_model .am-modal-bd").html(messPrompt)
			$("#class_model").modal({
				closeViaDimmer: false,
				onConfirm: function(options) {
					window.location.href = "personal/child_list.html"
		        },
			});
		}else{
	    	window.location.href = "class_time.html"
		}
	}else{
		//未登录
		var messPrompt="此功能仅对登录用户开放，是否需要登录？"
		$(".operationModalBody").html(messPrompt)
		$("#operationModal").modal({
			closeViaDimmer: false,
			onConfirm: function(options) {
				window.location.href = "login.html"
	        },
	        onCancel: function() {
	          
	        }
		})
	}
}
//进入商城
function seeShopp(){
	window.location.href = "shopp.html"
}
//进入个人中心
function checkPer(){
	if(slf.checkSign()){
		//已登录
		window.location.href = "personal/index.html"
	}else{
		//未登录
		window.location.href = "personal/noLogin.html"
	}
}
//初始化日期加载
function initDate(){
	if(slf.checkSign()){
		console.log("已登录")
		//已登录
		loginSign=1;
	}else{
		console.log("未登录")
		//未登录
		loginSign=0;
	}
    currDT = new Date();
    var dw = currDT.getDay(); //从Date对象返回一周中的某一天(0~6)
    var tdDT; //日期
    //循环加载星期
    var html1="";
    for(var i=dw;i<dw+7;i++){
    	var j=i%7;
    	var str2="周" + "日一二三四五六".charAt(j);
    	html1+="<td onclick='chioceWeek(this)'>"+str2+"</td>"
    }
    $("#mystable tr").append(html1)
    //循环加载日期
    for (var i = 0; i < 7; i++) {
    	var html2="";
    	let Stamp = new Date(); 
        Stamp.setDate(Stamp.getDate() + i); 
        html2+="<td onclick='chioceData(this)'><div><span>"+Stamp.getDate()+"</span></div></td>"
        $("#mytable tr").append(html2);
        var newtime = '<input type="text" value="' + year + "-" + (Stamp.getMonth() + 1) + "-" + Stamp.getDate() + '">';
        $(".newtime").append(newtime);
    }
    $("#mytable tr td:first").addClass("selec")
    var num = $('.selec').index();
    var startDate = $('.newtime').find('input').eq(num).val();
    if(loginSign==1&&slf.schoolId!=undefined&&slf.schoolId!='a'){
    	console.log(slf.schoolId)
    	console.log("获取学校id")
    	//已登录
		var param={
		   startDate : startDate,
	    };
		getCourList(param)
    }else if(loginSign==0||slf.schoolId==undefined||slf.schoolId=='a'){
    	console.log("未登录")
    	//未登录或信息不完善
		var param={
		   pageIndex : 1,
		   pageSize : 20,
		   startDate : startDate,
		   type:2
	    };
		getCourAllList(param)
    }
    //禁止查看今天之前的信息
    var nowTemp = new Date();
    var nowDay = new Date(nowTemp.getFullYear(), nowTemp.getMonth(), nowTemp.getDate(), 0, 0, 0, 0).valueOf();
    var nowMoth = new Date(nowTemp.getFullYear(), nowTemp.getMonth(), 1, 0, 0, 0, 0).valueOf();
    var nowYear = new Date(nowTemp.getFullYear(), 0, 1, 0, 0, 0, 0).valueOf();
    var $myStart2 = $('#doc-datepicker');
    var checkin = $myStart2.datepicker({
    	onRender: function(date, viewMode) {
            // 默认 days 视图，与当前日期比较
            var viewDate = nowDay;
            switch (viewMode) {
              // moths 视图，与当前月份比较
              case 1:
                viewDate = nowMoth;
                break;
              // years 视图，与当前年份比较
              case 2:
                viewDate = nowYear;
                break;
            }
            return date.valueOf() < viewDate ? 'am-disabled' : '';
          }
    })
}
/*查询课程包列表（未登录或信息不完善的）*/
function getCourAllList(param){
	$("#course").html("")
	slf.ajax({
    	url:"/system/getAloneCoursePage",
    	type:'get',
    	param : param,
		success : function(data){
			console.log(data)
			console.log("加载数据")
			var course = data.obj;
			var html = "";
			if(course.length<=0){
				html += '<img src="../img/zwsj.png" alt="img" style="width:100%">';				
			}
			for(var i = 0; i < course.length ; i++){
				html +='<li class="appointLi">'
				html +='<div class="appointDivs am-g" onclick="showDetail('+course[i].coursePageId+')">'   
				html +='<div class="curriculumImg am-u-sm-4 pad-0 am-u-md-3" style="height:90px;">' 
				if(course[i].coverPicture==undefined||course[i].coverPicture==null||course[i].coverPicture==''){
					var coverImg=slf.defau.courseIcon(course[i].coursePageId)
					html +='<img src="'+coverImg+'" /></div>'
				}else{
					html +='<img src="'+course[i].coverPicture+'" /></div>'
				}
				html +='<ul class="appointMess am-u-sm-8 pad-0 am-u-md-9" style="height:90px;">'
				html +='<li class="titleLi">'
				html +='<span class="titleDiv" style="width:100%;font-size:14px;">'+course[i].name+'</span>'
				html +='</li>'
				html +='<li class="descLi">' 
				if(course[i].briefIntroduction!=undefined){
					html +='<span class="desc" >简介：'+course[i].briefIntroduction+'</span>'
				}           
				html +='</li>'
				html +='<li class="timeLi">'
				html +='<span class="addrs" >地点：'+course[i].schoolName+'</span>'
				html +='</li>'
				html +='</ul></div>'
				html +='<div class="classOpen">'
				html +='<span class="classTime" style="font-size:12px;">销售时间：'+course[i].sales_start_date+'至'+course[i].sales_end_date+'</span>'
				if(course[i].discount_price==undefined||course[i].discount_price==null||course[i].discount_price==''){
			    	var money=course[i].price
			    }else{
			    	var money=course[i].discount_price
			    }
				html +='<span class="classStatus" onclick="goBuy('+money+','+course[i].school_course_page_id+')">立即购买</span>'
		        html +='</div>'
		        html +='<div class="classBelt" style="background:#fff;height:10px;"></div></li>'      
			}
			$("#course").html(html);
			yomi.yomi();
		}
	});
}
/*查询已登录返回数据*/
function getCourList(param){
	window.clearInterval(interval);
	slf.ajax({
    	url:"/epOrder/checkLastOneCourse",
    	type:'post',
    	param : param,
		success : function(data){
			console.log(data)
			//var course = eval('('+ data.obj+')' );
			var course =data.obj[0];
			//TODO 后期会有多个课程数据这时候需要遍历循环，待优化
			console.log(course);
			console.log("加载登录返回的数据")
			var html = "";
			if(course==undefined||course==null||course==''){
				html += '<img src="../img/zwsj.png" alt="img" style="width:100%">';				
			}else{
				html +='<li class="appointLi">'
				if(course.dataType==2){
					//课程包
					html +='<div class="appointDivs am-g" onclick="showDetail('+course.course_page_id+')">' 
				}else if(course.dataType==1){
					//课程
					html +='<div class="appointDivs am-g" onclick="showInDetail('+course.course_id+','+course.school_course_page_id+')">' 
				}
				html +='<div class="curriculumImg am-u-sm-4 pad-0 am-u-md-3" style="height:90px;">'
				if(course.cover_picture==undefined||course.cover_picture==null||course.cover_picture==''){
					var coverImg=slf.defau.courseIcon(course.school_course_page_id)
					html +='<img src="'+coverImg+'" />' 
				}else{
					html +='<img src="'+course.cover_picture+'" />' 
				}        
				html +='</div>'       
				html +='<ul class="appointMess am-u-sm-8 pad-0 am-u-md-9" style="height:90px;">'        
				html +='<li class="titleLi">'          
				html +='<span class="titleDiv" style="width:100%;font-size:14px;">'+course.name+'</span>'              
				html +='</li>'
				if(course.brief_introduction!=undefined&&course.dataType==2){
					html +='<li class="descLi" style="height:40px;">'
					html +='<span class="desc" >简介：'+course.brief_introduction+'</span>'
				}else if(course.brief_introduction!=undefined&&course.dataType==1){
					html +='<li class="descLi" style="height:20px;">'
					html +='<span class="descs" >简介：'+course.brief_introduction+'</span>'
				}           
				html +='</li>'
				html +='<li class="timeLi">'           
				html +='<span class="addrs" >地点：'+course.schoolName+'</span>'             
				html +='</li>'
				if(course.dataType==1&&course.classRoomName!=undefined&&course.classRoomName!=null&&course.classRoomName!=''){
					html +='<li class="timeLi">'           
					html +='<span class="addrs" >场馆：'+course.classRoomName+'</span>'             
					html +='</li>'
				}
				if(course.dataType==1&&course.courseTime!=undefined&&course.courseTime!=null&&course.courseTime!=''){
					html +='<li class="timeLi">'           
					html +='<span class="addrs" >时间：'+course.courseTime+'</span>'             
					html +='</li>'
				}
				html+='</ul></div>'
		    	if(course.dataType==2){
					//返回热门课程包(可购买)
					html +='<div class="classOpen">'    
				    html +='<span class="classTime" style="font-size:12px;">销售时间：'+course.sales_start_date+'至'+course.sales_end_date+'</span>'       
				    if(course.discount_price==undefined||course.discount_price==null||course.discount_price==''){
				    	var money=course.price
				    }else{
				    	var money=course.discount_price
				    }
				    html +='<span class="classStatus" onclick="goBuy('+money+','+course.school_course_page_id+')">立即购买</span>'       
				    html +='</div>'
				}else if(course.dataType==1){
					cutDownTime(course.countDown)
					//课程
					html +='<div class="classOpen">'    
				    html +='<span class="classTime" style="font-size:12px;">距开课：<span id="downTime"></span></span>'       
			    	if(course.courseSate==1){
						//(立即排队)
			    		if(course.discount_price==undefined||course.discount_price==null||course.discount_price==''){
					    	var money=course.price
					    }else{
					    	var money=course.discount_price
					    }
			    		html +='<span class="classStatus" style="background:#FF4646;" onclick="lineUp('+course.course_id+','+money+')">立即排队</span>' 
					}else if(course.courseSate==2){
						//排队中
						html +='<span class="classStatus" style="background:#fffbf2;color:#ff2f2a;border:none;">排队中</span>'
					}else if(course.courseSate==3){
						//取消
						html +='<span class="classStatus" style="background:#0A92F8;color:#fff" onclick="cancel('+course.id+')">取消</span>'
					}else if(course.courseSate==4){
						//即将开始
						html +='<span class="classStatus" style="background:#fffbf2;color:#ff2f2a;border:none;">即将开始</span>'
					}   
				    html +='</div>'
				}
			        
			    html +='<div class="classBelt" style="background:#fff;height:10px;"></div></li>'   
			}
			$("#course").html(html);
			yomi.yomi();
		}
	});
}
//立即排队
function lineUp(course_id,money){
	$(".zcc").removeClass("am-hide");
	setTimeout(function(){
		$(".zcc").addClass("am-hide")
		$('#class_model .am-modal-hd').html("是否花费<span class='text-FF2A2A'>"+money+"</span>个立方币排队此课程?");
		var $confirm = $('#class_model');
	    var confirm = $confirm.data('amui.modal');
	    var onConfirm = function() {
	    	slf.ajax({
	            url: "/epOrder/addEPOrder",
	            param : {
	            	courseId : course_id,
	            },
	            success: function (data) {
	            	console.log(data)
	            	console.log("立即排队")
	               if(data.res==1){
	            	   clearInterval(interval);
	            	   $(".alert1").html("排队成功！");
						$('#alert1').modal({
							closeViaDimmer: false,
						})
	            	   var num = $('.selec').index();
	            	   var startDate = $('.newtime').find('input').eq(num).val();
	            	   var param={
	    				   startDate : startDate,
	    			    };
	            	   getCourList(param)
	               }
	            }
	        });
	    };
	    var onCancel = function() {
	    	
	    }
	    if (confirm) {
	      confirm.options.onConfirm =  onConfirm;
	      confirm.options.onCancel =  onCancel;
	      confirm.toggle(this);
	    } else {
	      $confirm.modal({
	        relatedElement: this,
	        closeViaDimmer: false,
	        onConfirm: onConfirm,
	        onCancel: onCancel
	      });
	    }
	},1)
}
//取消
function cancel(course_id){
	$(".zcc").removeClass("am-hide");
	setTimeout(function(){
		$(".zcc").addClass("am-hide")
		$('#class_model .am-modal-hd').html("是否确定取消本课程？");
		var $confirm = $('#class_model');
	    var confirm = $confirm.data('amui.modal');
	    var onConfirm = function() {
	    	slf.ajax({
		        url: "/epOrder/updateState",
		        param : {
		        	id : course_id,
		        	state:3,
		        },
		        success: function (data) {
		           if(data.res==1){
		        	   $(".alert1").html("取消成功！");
						$('#alert1').modal({
							closeViaDimmer: false,
						})
		        	   clearInterval(interval);
					   $("#course").html("")
		        	   var num = $('.selec').index();
		        	   var startDate = $('.newtime').find('input').eq(num).val();
		        	   var param={
						   startDate : startDate,
					    };
		        	   getCourList(param)
		           }
		        }
		    });
	    };
	    var onCancel = function() {
	    	
	    }
	    if (confirm) {
	      confirm.options.onConfirm =  onConfirm;
	      confirm.options.onCancel =  onCancel;
	      confirm.toggle(this);
	    } else {
	      $confirm.modal({
	        relatedElement: this,
	        closeViaDimmer: false,
	        onConfirm: onConfirm,
	        onCancel: onCancel
	      });
	    }
	},1)
	
}
/*跳转课程包详情页面*/
function showDetail(coursePageId){
	window.location.href='basepkg.html?coursePage='+coursePageId+'&order=y'
}
/*跳转课程详情*/
function showInDetail(courseId,coursePageId){//小包Id
	window.location.href='basepkg_details.html?courseId='+courseId+'&coursePageIds='+coursePageId;
}
function cutDownTime(time){
	var totalSecond = time;
    interval = setInterval(function () {
      // 秒数  
      var second = totalSecond;
      // 天数位  
      var day = Math.floor(second / 3600 / 24);
      var dayStr = day.toString();
      if (dayStr.length == 1) dayStr = '0' + dayStr;

      // 小时位  
      var hr = Math.floor((second - day * 3600 * 24) / 3600);
      var hrStr = hr.toString();
      if (hrStr.length == 1) hrStr = '0' + hrStr;

      // 分钟位  
      var min = Math.floor((second - day * 3600 * 24 - hr * 3600) / 60);
      var minStr = min.toString();
      if (minStr.length == 1) minStr = '0' + minStr;

      // 秒位  
      var sec = second - day * 3600 * 24 - hr * 3600 - min * 60;
      var secStr = sec.toString();
      if (secStr.length == 1) secStr = '0' + secStr;
      totalSecond--;
      if (totalSecond < 0) {
    	  $("#downTime").html("已结束")
          clearInterval(interval);
      }else{
    	  $("#downTime").html(dayStr+"天"+hrStr+"小时"+minStr+"分钟"+secStr+"秒")
      }
    }.bind(this), 1000);
}
//取得当前日期一周内的某一天
function getWeek(i) {
    var now = new Date();
    var n = now.getDay();
    var start = new Date();
    start.setDate(now.getDate() - n + i); //取得一周内的第一天、第二天、第三天...
    return start;
}
function getWeekss(i) {
    var now = new Date($("#doc-datepicker").val().replace(/-/g,   "/"));
    var n = now.getDay();
    var start = new Date();
    start.setDate(now.getDate() - n + i); //取得一周内的第一天、第二天、第三天...
    return start;
}

//取得当前日期一周内的七天
function getDays() {
    var days = new Array();
    for (var i = 1; i <= 7; i++) {
        days[i - 1] = getWeek(i);
    }
    return days;
}
function getDayss() {
    var days = new Array();
    for (var i = 1; i <= 7; i++) {
        days[i - 1] = getWeekss(i);
    }
    return days;
}

/**********************************************************************/
//点击选择日期
function chioceData(obj){
	clearInterval(interval);
	var num = $(obj).index();
	$("#my-modal-loading").modal('open')
	setTimeout(function(){
	  $('#my-modal-loading').modal('close');
	},1000);
	if(num < 7){
		$("#mytable tr td").removeAttr("class");
	    $(obj).attr("class", "selec");
	    var num = $(obj).index();
	    $(".datetime").find("input").val($(".newtime").find("input").eq(num).val());
	    var startDate = $('.newtime').find('input').eq(num).val();
	    if(loginSign==1&&slf.schoolId!=undefined&&slf.schoolId!='a'){
	    	//已登录
			var param={
			   pageIndex : 1,
			   pageSize : 20,
			   startDate : startDate,
			   schoolId:slf.schoolId,
			   type:2
		    };
			getCourList(param)
	    }else if(loginSign==0||slf.schoolId==undefined||slf.schoolId==null||slf.schoolId=='a'){
	    	//未登录或信息不完善
			var param={
			   pageIndex : 1,
			   pageSize : 20,
			   startDate : startDate,
			   type:2
		    };
			getCourAllList(param)
	    }
	}
}
//点击星期时间
function chioceWeek(obj){
	clearInterval(interval);
	var num = $(obj).index();
	$("#my-modal-loading").modal('open')
	setTimeout(function(){
	  $('#my-modal-loading').modal('close');
	},1000);
	if(num < 7){
		$("#mytable tr td").removeAttr("class");
		$("#mytable tr").find("td").eq(num).attr("class","selec");
		$(".datetime").find("input").val($(".newtime").find("input").eq(num).val());
	    var startDate = $('.newtime').find('input').eq(num).val();
	    if(loginSign==1&&slf.schoolId!=undefined&&slf.schoolId!='a'){
	    	//已登录
			var param={
			   pageIndex : 1,
			   pageSize : 20,
			   startDate : startDate,
			   schoolId:slf.schoolId,
			   type:2
		    };
			getCourList(param)
	    }else if(loginSign==0||slf.schoolId==undefined||slf.schoolId==null||slf.schoolId=='a'){
	    	//未登录或信息不完善
			var param={
			   pageIndex : 1,
			   pageSize : 20,
			   startDate : startDate,
			   type:2
		    };
			getCourAllList(param)
	    }
	}
}

//模态框确认按钮
$('.default').on('change',function(){
	 window.clearInterval(interval);
	$("#my-modal-loading").modal('open')
	setTimeout(function(){
	  $('#my-modal-loading').modal('close');
	},1000);
	var startDate = $("#doc-datepicker").val();
	var today=new Date(startDate.replace(/-/g,"/"));
	var year = today.getFullYear(); //获取当前年份
	var dw = today.getDay(); //从Date对象返回一周中的某一天(0~6) 显示的是当前日期位置 
	var dataTime=today.getDate();
	$("#mystable tr").html("");
	$("#mytable tr").html("")
    //循环加载星期
    var html1="";
    for(var i=dw;i<dw+7;i++){
    	var j=i%7;
    	var str2="周" + "日一二三四五六".charAt(j);
    	html1+="<td onclick='chioceWeek(this)'>"+str2+"</td>"
    }
    $("#mystable tr").append(html1)
    //循环加载日期
    for (var i = 0; i < 7; i++) {
    	var html2="";
    	let Stamp = new Date(startDate.replace(/-/g,"/"));
    	Stamp.setDate(Stamp.getDate() + i); 
        html2+="<td onclick='chioceData(this)'><div><span>"+Stamp.getDate()+"</span></div></td>"
        $("#mytable tr").append(html2);
        var newtime = '<input type="text" value="' + year + "-" + (Stamp.getMonth() + 1) + "-" + Stamp.getDate() + '">';
        $(".newtime").append(newtime);
    }
    $("#mytable tr td:first").addClass("selec")
    var startDate = $("#doc-datepicker").val();
	if(startDate != ''){
		if(loginSign==1&&slf.schoolId!=undefined&&slf.schoolId!='a'){
	    	//已登录
			var param={
			   pageIndex : 1,
			   pageSize : 20,
			   startDate : startDate,
			   schoolId:slf.schoolId,
			   type:2
		    };
			getCourList(param)
		 }else if(loginSign==0||slf.schoolId==undefined||slf.schoolId=='a'){
	    	//未登录或信息不完善
			var param={
			   pageIndex : 1,
			   pageSize : 20,
			   startDate : startDate,
			   type:2
		    };
			getCourAllList(param)
	    }
	}
})


//立即购买

function goBuy(money,coursePageIds){
	$(".zcc").removeClass("am-hide")
	setTimeout(function(){
		if(slf.checkSign()){
			var childMess=slf.getSequenceChild();
			if(slf.schoolId=='a'||slf.schoolId==undefined||slf.schoolId==null){
				$(".zcc").addClass("am-hide")
				var messPrompt="请先完善孩子信息，是否现在去完善？"
				$("#class_model .am-modal-bd").html(messPrompt)
				$("#class_model").modal({
					closeViaDimmer: false,
					onConfirm: function(options) {
						window.location.href = "personal/child_list.html"
			        },
				});
			}else{
				console.log(childMess)
				console.log("获取返回孩子信息")
				if(childMess.state==0){//无期望上课时间
					console.log("无孩子期望上课时间")
					$(".zcc").addClass("am-hide")
					$("#cancleModal .am-modal-bd").html("您还未选择孩子期望上课时间段，是否现在去完善？")
					$("#cancleModal").modal({
						relatedTarget: this,
						closeViaDimmer: false,
						onConfirm: function(options) {
							window.location.href = "personal/add_child.html?userId="+childMess.userId+"&childrenId="+childMess.childrenId+""; //去其网上可时间  
						}
					})
				}else if(childMess.state==1){//you期望上课时间
					console.log("有孩子期望上课时间");
					$(".zcc").addClass("am-hide")
					$('#class_model .am-modal-bd').html("是否花费<span class='text-FF2A2A'>"+money+"</span>个立方币购买本课程包?");
					var $confirm = $('#class_model');
				    var confirm = $confirm.data('amui.modal');
				    var onConfirm = function(){
				    	slf.ajax({
							url:'/myCoursePage/insertMyCoursePage',
							param:{
								courseId:coursePageIds,
								childrenId:childMess.childrenId
							},
							success:function(data){
								console.log(data)
								console.log("判断是否购买")
								var course = data.obj;
								//TODO 后台异常获取抛出有误
								if(data.res != 1){
									if(data.resMsg=="余额不足。"){
										$("#buyMoneyModal").modal({
											relatedTarget: this,
											closeViaDimmer: false,
									        onConfirm: function(options) {
									        	window.location.href = "recharge.html"; //去充值页面
									        },
										});
									}else{
										$("#alert_model .am-modal-bd").html("<span>"+data.resMsg+"</span>");
										$('#alert_model').modal();
									}
								}else{
									clearInterval(interval);
									$(".alert1").html("<span>"+data.resMsg+"</span>");
									$('#alert1').modal({
										closeViaDimmer: false,
									});
									var num = $('.selec').index();
					        	    var startDate = $('.newtime').find('input').eq(num).val();
					        	    console.log(startDate)
					        	    console.log("取消成功传的参数")
					        	    var param={
									   startDate : startDate,
								    };
									getCourList(param)
								}
							}
						});
				    };
				    var onCancel = function() {}
				    if (confirm) {
				      confirm.options.onConfirm =  onConfirm;
				      confirm.options.onCancel =  onCancel;
				      confirm.toggle(this);
				    }else{
				    	$confirm.modal({
				        relatedElement: this,
				        closeViaDimmer: false,
				        onConfirm: onConfirm,
				        onCancel: onCancel
				      });
				    }
				}
			}
		}else{
			$(".zcc").addClass("am-hide")
			var messPrompt="此功能仅对登录用户开放，是否需要登录？"
				$(".operationModalBody").html(messPrompt)
				$("#operationModal").modal({
					closeViaDimmer: false,
					onConfirm: function(options) {
						window.location.href = "login.html"
			        },
			        onCancel: function() {
			          
			        }
				})
		}
	},1)
		
}